package com.itheima.mybatis_plus.controller;

import com.itheima.mybatis_plus.pojo.User;
import com.itheima.mybatis_plus.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author huyoufu <https://github.com/huyoufu>
 * @TIME 2021/10/9 8:45
 * @description
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
    @GetMapping("/findAll")
    public List findAll(){
       List<User> list= userService.findAll();

       return list;
    }
    @GetMapping("/findById")
    public User findById(@RequestParam("id") int id){
        return  userService.findById(id);
    }
}
